package com.trafficsys.modules.owner.service.impl;

import com.trafficsys.modules.owner.dao.EditMessageDao;
import com.trafficsys.modules.owner.service.EditMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service
public class EditMessageImpl implements EditMessageService {
    @Autowired
    EditMessageDao editMessageDao;

    /**
     * 根据cardId修改密码
     * @param cardId
     * @return
     */
    @Override
    public HashMap<String, Object> updateDriverPassword(String cardId,String password) {
        HashMap<String,Object> map=new HashMap<>();
        int i=editMessageDao.updatePasswordByCardId(cardId,password);
        if(i>0){
            map.put("msg","SUCCESS");
        }else {
            map.put("msg","FAILED");
        }
        return map;
    }


    /**
     * 根据cardId修改绑定手机号
     * @param cardId
     * @return
     */
    @Override
    public HashMap<String, Object> updateTelByCardId(String cardId,String phone) {
        HashMap<String,Object> map=new HashMap<>();
        int i=editMessageDao.updateTelByCardId(cardId,phone);
        if(i>0){
            map.put("msg","SUCCESS");
        }else {
            map.put("msg","FAILED");
        }
        return map;
    }
}
